package top.csy8888.ch08.service;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.stereotype.Service;
import top.csy8888.ch08.config.RabbitConfig;

import java.util.Map;

/**
 * @author CSY
 * @date 2025 - 10 - 16
 * 普通的消费者服务
 */
@Service
@Slf4j
public class ConsumerService {
    @RabbitListener(queues = RabbitConfig.QUEUE_NAME)
    /*@RabbitListener(bindings = @QueueBinding(
            value = @Queue(
                    name = RabbitConfig.QUEUE_NAME,
                    durable = "false",
                    arguments = {
                            @Argument(name = "x-dead-letter-exchange",value = RabbitConfig.DEAD_EXCHANGE_NAME),
                            @Argument(name = "x-dead-letter-routing-key",value = RabbitConfig.DEAD_ROUTING_KEY)
                    }
            ),
            exchange = @Exchange(name = RabbitConfig.EXCHANGE_NAME,type = ExchangeTypes.DIRECT),
            key = RabbitConfig.ROUTING_KEY
    ))*/
    public void receive(String message) {
        log.info("receive message: {}", message);
    }
}
